package com.shujia.wyh.day27.danli;

public class Teacher {

    private static Teacher teacher = null;

    private Teacher() {
    }

    //t1,t2,t3
//    public static Teacher getTeacher() {
//        synchronized (Teacher.class){
//            if (teacher == null) {
//                //t1,t2,t3
//                teacher = new Teacher();
//            }
//
//            return teacher;
//        }
//    }

    public synchronized static Teacher getTeacher() {
        if (teacher == null) {
            //t1,t2,t3
            teacher = new Teacher();
        }

        return teacher;
    }
}
